<template>
	<view>
		<view class="con" v-for="(item,index) in noticeList" :key="index">
			<view class="box">
				<view class="box-title">
					<text>{{item.title}}</text>
				</view>
				<view class="box-time">
					<text>{{getTime(item.createTime)}}</text>
				</view>
				<view class="box-detail">
					<text selectable="true">{{item.detail}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	//引入网络请求
	import {
		getSystemNoticeByPage
	} from '@/api/http/main/home/system_notice.js'

	//时间处理
	import {
		handleNowTime
	} from '@/utils/time/time.js'

	export default {
		data() {
			return {
				page: 1,
				size: 10,
				//总页数
				total: 0,
				noticeList: []
			}
		},
		methods: {
			getTime(time) {
				return handleNowTime(time);
			},

			getSystemNoticeByPage(page, size) {
				getSystemNoticeByPage(page, size).then(res => {
					if (res.data.pubInfo.code !== 0) {
						return uni.$showMsg(res.data.pubInfo.message);
					}
					this.total = res.data.pageInfo.total
					this.noticeList = res.data.busInfo
					//console.log(res.data)
				})
			}
		},
		onLoad() {
			this.getSystemNoticeByPage(1, 10)
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F5F5F5;
	}

	.con {
		width: 100%;
		padding: 30rpx 0;

		.box {
			// margin-top: 30rpx;
			width: 88%;
			margin-left: 3%;
			padding: 15rpx 3%;
			background-color: #fff;
			border-radius: 20rpx;

			.box-title {
				text {
					font-size: 32rpx;
				}
			}

			.box-time {
				margin: 10rpx 0;

				text {
					font-size: 28rpx;
					color: #B6B6B6;
				}
			}
			
			.box-detail{
				text{
					font-size: 28rpx;
				}
			}
		}
	}
</style>